package mes.kanban.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import mes.kanban.config.KVRedisConfig;
import mes.kanban.service.RedisServiceI;
import mes.kanban.util.IsNotNullValit;
import mes.kanban.vo.AjaxReturnVO;

/**
 * 动态更改样式辅助类
 * @author gjy
 *
 * 2018年3月15日下午3:43:33
 */
@RestController
public class ChangeFontController {
	
	@Autowired
	private RedisServiceI redisService;
	
	@RequestMapping("/changeKanbanCss")
	public AjaxReturnVO changeMessage() {
		
		AjaxReturnVO vo = new AjaxReturnVO();
		
		String key = KVRedisConfig.CHANGE_FONTSIZE.getHaskey();
		
		String value = redisService.getConfig(key);
		
		if (IsNotNullValit.StringIsNotNull(value)) {
			
			if ("-1".equals(value)) {
				vo.setOk(false);
			}else {
				vo.setOk(true);
			}
			
		}else {
			redisService.setConfig(key, "-1");
		}
		
		return vo;
	}
	
	
	@RequestMapping("/changeKanbanCssok")
	public void changeKanbanCssok() {
		
		
		String key = KVRedisConfig.CHANGE_FONTSIZE.getHaskey();
		
		redisService.setConfig(key, "-1");
	}
	

}
